﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;

namespace csharpcore7_ch6.Chapt6_1StringAndTextProcessing
{
    class Chapt6_1_3_3SequenceComparisonOfStrings
    {
        //CompareTo不使用序列比较。 这是因为对于排序来说，文化相关的算法更为有效
        static void Main()
        {
            Console.WriteLine("Boston".CompareTo("Austin")); //1
            Console.WriteLine("Boston".CompareTo("Boston"));//0
            Console.WriteLine("Boston".CompareTo("Chicago"));//-1
            Console.WriteLine("中文".CompareTo("中文"));    //0
            Console.WriteLine("文".CompareTo("中"));      //-1

            //使用当前的文化进行不区分大小写的比较
            Console.WriteLine(string.Compare("foo","FOO",true)); //0

            CultureInfo german = CultureInfo.GetCultureInfo("de-DE");
            int i = string.Compare("Muller","Muller",false,german);
            Console.WriteLine(i);
        }
    }
}
